//
//  CJExten+Double.swift
//  CJCore
//
//  Created by 陈警卫 on 2024-06-13.
//

import Foundation

public extension Double {
    
    /// *0.5
    var cj_half: Double {
        return self * 0.5
    }
    
    /// 倍率
    func cj_multip(_ value: Double = 1.0) -> Double {
        return self * value
    }
    
    /// 角度转弧度
    func cj_radian() -> Double {
        return (.pi * self) / 180.0
    }
    
    /// 角弧度转角度
    func cj_angle() -> Double {
        return (self * 180.0) / .pi
    }
    
}

public extension CGFloat {
    
    /// *0.5
    var cj_half: CGFloat {
        return self * 0.5
    }
    
    /// 倍率
    func cj_multip(_ value: CGFloat = 1.0) -> CGFloat {
        return self * value
    }
    
    /// 角度转弧度
    func cj_radian() -> CGFloat {
        return (.pi * self) / 180.0
    }
    
    /// 角弧度转角度
    func cj_angle() -> CGFloat {
        return (self * 180.0) / .pi
    }
    
}
